<?php 
header("content-type:text/html;charset=utf8");
//pdo连库
$pdo  = new PDO("mysql:host=127.0.0.1;dbname=07c;","root","root");
//sql语句
$sql = "select * from yuan";
$res = $pdo->query($sql)->fetchAll(PDO::FETCH_ASSOC);
// print_r($res);die;
//实例化
$redis = new redis();
//连接
$redis->connect("127.0.0.1","6379");
//取得缓存
$ress = $redis->get("ress");
//判断非空
if (empty($ress)) {
	$ress = json_encode($res);
	// print_r($redis);die;
	$ress = $redis->set('ress',$ress);
}
//使用列表类型存储100个元素
for ($i=1; $i <=100; $i++) { 
	$redis->lpush("id",$i);
}



 ?>